
<%--
  Created by IntelliJ IDEA.
  User: 86188
  Date: 2023/8/8
  Time: 18:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="path" value="${pageContext.request.contextPath }"/>
<html>
<head>
    <title>用户列表</title>
<%--    <link href="${path}/css/wqlCss/userlist.css " rel="stylesheet" type="text/css">--%>
    <script type="text/javascript" rel="script" src="${path}/js/jquery-3.6.4.js"></script>
    <style>
        .b1{
            width: 100px;
            height: 30px;
            text-align: center;
            line-height: 30px;
            display: inline-block;
            margin-bottom: 10px;
            margin-left: 10px;
            background-color: #00cc9c;
            color: white;
            border-radius: 3px 3px 3px 3px;
            font-size: 12px;
            border: 0px;
        }
        .a1{
            width: 60px;
            height: 80px;
            text-align: center;
        }
        .a3{
            width: 150px;
            text-align: center;
        }
        .a4{
            text-align: center;
            width: 100px;
        }
        .a5{
            text-align: center;
            width: 50px;
        }
        .a6{
            width: 50px;
            text-align: center;
        }
        .a7{
            width: 100px;
            text-align: center;
        }
        .a8{
            width: 200px;
            text-align: center;
            color: #00e689;
        }
        .a9{
            width: 200px;
            text-align: center;
        }
        .img1{
            width: 40px;
            height: 40px;
        }
        .eihei{
            background: white;
            padding:30px 30px 30px 30px;
        }
        .big .t{
            height:20px;
            width: 130px;
            background: url("${path}/images/backIndex/right_bg.gif") repeat;
            font:10px 宋体;
            padding:10px 0 0 30px;
        }
        .table{
            width: 1025px;
            border: 0px gainsboro;
            border-collapse: collapse;
        }

    </style>

    <link rel="stylesheet" href="${path}/back-end-jsp/css/font.css" charset="UTF-8">
    <link rel="stylesheet" href="${path}/back-end-jsp/css/index.css" charset="UTF-8">
</head>
<body>
<div class="big">
    <div class="t">
        用户信息
    </div>
<div class="eihei">
    <div class="b1">
        <a href="${path}/jsp/increaselist.jsp">添加</a>
    </div>
    <table class="table" border="1">
        <tr>
            <th>头像</th>
            <th>用户名</th>
            <th>角色</th>
            <th>状态</th>
            <th>性别</th>
            <th>手机</th>
            <th>邮箱</th>
            <th>添加时间</th>
            <th>操作</th>
        </tr>
        <c:set var="manageUserList" value="${requestScope.manageUserList}"/>
        <c:choose>
            <c:when test="${empty manageUserList}">
                <script>
                    window.location="${path}/ManageuserServlet?prom=showAll";
                </script>
            </c:when>
            <c:otherwise>
                <c:forEach var="ml" items="${manageUserList}">
                    <tr id="${ml.mana_id}">
                        <td class="a1"><img class="img1" src="${path}/images/userAvatar/${ml.mana_photo}"></td>
                        <td class="a3">${ml.mana_name}</td>
                        <td class="a4">${ml.mana_role}</td>
                        <td class="a5">
                            <c:if test="${ml.mana_state==1}">正常</c:if>
                            <c:if test="${ml.mana_state==0}">异常</c:if>
                        </td>
                        <td class="a6">${ml.mana_sex}</td>
                        <td class="a7">${ml.mana_phone}</td>
                        <td class="a8">${ml.mana_email}</td>
                        <td class="a9">${ml.mana_insTime}</td>
                        <td>
                            <p>
                                <a onclick="jQuery:window.location='${path}/ManageuserServlet?prom=selectId&mana_id=${ml.mana_id}'">
                                    <img src="${path}/images/tool/xiugai.jpg" width="30px" height="30px"/>
                                </a>
                                <a onclick="delUser(${ml.mana_id})" style="margin-left: 10px">
                                    <img src="${path}/images/tool/shanchu.jpg" width="30px" height="30px"/>
                                </a>
                            </p>
                        </td>
                    </tr>
                </c:forEach>
            </c:otherwise>
        </c:choose>
    </table>
</div>
</div>
<script type="text/javascript">
    function delUser(id){
        var str=confirm("确定删除该用户吗？");
        if (str){
            $.getJSON("${path}/ManageuserServlet?prom=del","id="+id,function (data){
                if (data>0){
                    $("#"+id).remove();//移除当前删除的行
                }else {
                    alert("删除失败");
                }
            });
        }
    }
</script>
</body>
</html>
